package com.lx.mobileplayer.mvp.persenter

import com.itheima.player.model.bean.MvPagerBean
import com.itheima.player.model.bean.VideosBean
import com.lx.mobileplayer.mvp.view.Iview.IMvChildView
import com.lx.mobileplayer.net.OkHttpUtil
import com.lx.mobileplayer.net.URLProvider

/**
 * 类说明：首页的presenter
 * Created by liuxiong on 2019/4/27.
 */
class MvChildPresenter(view: IMvChildView):BasePresenter<IMvChildView>(view) {

    fun requestData(area:String ,offset:Int,pageSize:Int){

        var url= URLProvider.getMVListUrl(area,offset,pageSize)

        OkHttpUtil.instance.request(url,object : OkHttpUtil.ResultCallBack<MvPagerBean>() {
            override fun succecss(data: MvPagerBean) {
                getView().loadSuccess(data.videos as ArrayList<VideosBean>)
            }

            override fun failed(code: Int, errorMessage: String) {
                getView().loadFailed(code,errorMessage)
            }
        })

    }

}